Skip to content

PathScope v2.2 → v2.6.0: review workflow, capture intelligence, governance - #1

Merged
mrdineshpathro merged 8 commits into
mainfrom
arena/6012c5eb-pathscope
Nov 29, 2026
Merged

mrdineshpathro merged 8 commits into
mainfrom
arena/6012c5eb-pathscope

Conversation

@mrdineshpathro

Copy link
Copy Markdown
Owner

Summary

This branch takes PathScope from v2.1 to v2.6.0 — 40 features across five releases, every one with per-feature unittest coverage and a README section.

Release Theme Features
v2.2 Operator tooling watch mode, interactive HTML reports, rule registry, CI toolkit, 6 input formats, presets, diff/suppression
v2.3 Review workflow TUI reviewer, review ledger, history/trends, dashboard/inventory, playbooks, streaming stdin, reproducible bundles, correlation, secret scrubbing, installers
v2.4 Capture intelligence acceptance expiry, capture-to-capture diff, offline URL extraction, value statistics, rule coverage, term packs, preset comparison, calibration, project files, reviewed-aware CI
v2.5 Team workflow path families, review queue, policy shadow mode, deterministic sampling, scope files, OpenAPI matching, work-item export, PR comments, host redaction, shell completion
v2.6 Governance waivers, suppression audit, rule precision, rule impact, weight simulation, score-change explanation, safe --where, run attestation, owner assignment, ledger merge

Verification

  • 769 tests OK (python3 -m unittest discover -s tests)
  • --self-test 35/35 — "No network access was used."
  • --doctor 10/10
  • 137 CLI flags, all documented; all 63 README TOC anchors resolve (checked programmatically)
  • No eval/exec anywhere in the package; no network-capable import in any module

Design decisions worth reviewing

Safety invariants held throughout. Passive and offline — no module imports socket, http, urllib.request, ssl or anything that could make a request. Stdlib only, no third-party dependencies. Values are hidden by default and never appear in tickets, attests, PR comments or attestations, even with --show-values. The candidate-not-vulnerability language is preserved in every output format.

Three bugs found by the test suite, all real:

  1. --where filtering narrowed report_data.findings, which --fail-on-findings then read — so --where "score > 999" made the CI gate pass while every candidate still existed. A false green. The gate now snapshots the unfiltered count before filtering.
  2. Scope globs: * matched across dots, so *.acme.test silently covered deep.api.acme.test — a far wider authorisation boundary than anyone wrote. * now matches one label, ** matches any number.
  3. A lone CDN host was adopted as the application origin during URL extraction, which would resolve relative paths against somebody else's infrastructure. Origin inference now requires a majority host and refuses to guess otherwise.

The host-doubling defect recurred four times (a.testhttps://a.test/view) across shadow mode, tickets, simulation and assignment. It now lives in one textutil.display_location() helper with its own regression test rather than a fifth local copy.

Deliberate limits, stated in the output rather than papered over:

  • Attestations are digests, not signatures — every file carries "signature": null and a note saying so. Claiming otherwise would be false assurance.
  • Rendezvous-hash owner assignment is proportional in expectation, not exactly balanced; forcing exact balance would break determinism and stability under team growth. The actual split is always printed.
  • Renames in capture diff require a shared name token — shape-only pairing was producing plausible nonsense.
  • Ownerless/expired waivers are refused or ignored; an expired waiver hides nothing.

Known unverified

install.cmd has never been executed on Windows. install.sh and the Dockerfile are covered by tests.

Test plan

python3 -m unittest discover -s tests   # 769 OK
python3 path_detector.py --no-banner --self-test   # 35/35
python3 path_detector.py --no-banner --doctor      # 10/10
python3 path_detector.py --no-banner --completion bash | bash -n   # valid

🤖 Generated with Claude Code

mrdineshpathro and others added 8 commits November 29, 2026 10:16
- path_detector.py: stdlib-only CLI, local-only parsing, no network/DNS,
  name + existing-value heuristics, hidden values by default, JSON output,
  terminal-aware colour, banner links, strict exit codes
- tests/test_path_detector.py: 97 unittest cases incl. safety assertions
- assets/logo.svg: original route + magnifier repository icon
- README.md: Kali usage, scoring model, limitations, authorization notice

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Restructure the monolithic v1 tool into pathscope/ modules:
  textutil (bounded decoding, sanitising), heuristics (name/value rules),
  sources (URL/list/stdin/HAR 1.2), detector (no I/O), report
  (text/JSON/CSV/SARIF), config (strict JSON), cli, __main__

New capabilities:
  - HAR 1.2 query, form (params + urlencoded) and flattened JSON parameters
  - auto-detection of HAR vs URL lists, --format har/urls/auto
  - --format text|json|csv|sarif, --json, --input-format, --output-format
  - bounded multi-pass percent decoding (default 3, max 5), segment-only
    traversal matching, malformed-escape tolerance
  - values hidden by default, credentials masked, query strings/body never
    printed, control characters stripped from every renderer
  - repeatable --ignore-param, strict JSON config for name terms/ignores
  - --fail-on-findings with documented exit codes (0/1/2/3/130)
  - deterministic output across runs and input order

Tests: 138 unittest cases incl. HAR parsing, redaction, format stability,
malformed input, and safety (import allow-list, no sockets, values never
opened as files). README rewritten for Kali usage and rule tables.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Features
- presets: minimal (>=50, weak names off), balanced (>=25), noisy (>=10),
  with strict/high/default/loud/broad aliases; --init-config writes a
  validated starter JSON and refuses to overwrite
- config inheritance: validated 'extends' (preset name or relative .json),
  list merge, scalar override, cycle + depth (4) protection
- Baselines/diff: stable 16-hex fingerprints (host+location+param+rule+path),
  --baseline and --suppress, --show-known, resolved list, --mark-reviewed
  ledger; --fail-on-findings gates on new candidates in diff mode
- inputs: Burp proxy XML (base64/plain, form/JSON/multipart), OpenAPI/Swagger
  parameter inventory, raw HTTP requests (### separated), recon exports
  (httpx/ffuf/katana/nuclei lines and JSONL) with auto-detection refined so
  plain URL lists keep their format
- outputs: Markdown and HTML reports (--save-report, --output-format), fully
  escaped, plus fingerprints/status in JSON, CSV and SARIF partialFingerprints
- UX: --explain/--explain-value scoring trace, --top, --group-by,
  --summary-only compact view

Tests: 209 total (71 new) covering presets, extends cycles, fingerprint
stability, baseline flows and exit codes, suppression ledgers, explain output,
Burp/OpenAPI/raw/recon parsing, Markdown/HTML escaping, and new report metadata.
README updated with presets, diff workflow, extra inputs and CLI reference.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
… toolkit

Eight feature groups, each with tests and README sections.

1. Live watch mode (--watch FILE --interval N)
   Re-reads a growing HAR/URL file and prints only candidates not reported
   before. Polls skip unchanged files (size+mtime), a shrunk/rotated capture
   starts a fresh baseline, transient read errors retry quietly, Ctrl-C stops
   with a summary. A missing file is a usage error instead of an endless loop.

2. Interactive HTML report (--save-report FILE.html --interactive)
   Self-contained page: sortable columns, text and confidence filters,
   reviewed-only mode, localStorage review marks, copy-fingerprint buttons and
   print CSS. No external assets, no network primitives in the inline script;
   every dynamic string is escaped exactly like the static writer.

3. Rule registry and tuning (--list-rules, --rules, --disable-rule)
   New pathscope/rules.py holds all 29 rules with layer, default weight and
   description. Weights can be overridden or rules removed at runtime; unknown
   ids, out-of-range weights and positive demotions are rejected. --explain now
   reports the effective book, folded/i18n settings and overridden weights.

4. CI toolkit (--policy, --init-policy, junit, --github-annotations, --self-test)
   New pathscope/policy.py evaluates max_high/medium/low/total, min_score,
   fail_on_known, ignore_rules and ignore_hosts against new findings, with
   explainable violations and exit code 1. New pathscope/ci.py renders JUnit
   XML, GitHub workflow annotations (escaped per the Actions spec) and the
   ten-check --self-test. Adds .github/workflows/pathscope.yml,
   .pre-commit-hooks.yaml, an example config and .pathscope/policy.json.

5. Scale helpers (--dedupe-by, --max-entries, --stats, --progress)
   Findings collapse by path (default), parameter or not at all; input entries
   can be capped with a reported truncation warning; --stats records phase
   timings on stderr and in JSON; --progress writes rate-limited updates to
   stderr only, leaving stdout machine-readable.

6. More tool exports (postman, zap, mitmproxy, graphql, cookies)
   New pathscope/tool_formats.py parses Postman v2.x collections (nested
   folders, query/urlencoded/formdata/raw bodies), ZAP JSON history and alert
   exports, mitmproxy flow exports and GraphQL introspection results. Cookie
   jars contribute names only; values are discarded before analysis.

7. Fuzzy and multilingual names (--name-lang, --no-fold)
   New pathscope/naming.py folds diacritics, compatibility forms, exotic
   separators and invisible characters, expands bounded leet spellings
   (f1le -> file) and ships German, Spanish, French, Portuguese, Italian and
   Dutch term packs. Folded matches use weaker rules (name-folded +20,
   name-leet +12, name-i18n-fold +21) and English tables always win.

8. Value-shape demotion (--no-demote, --disable-rule)
   New pathscope/valueshape.py recognises UUIDs, hex digests, JWTs, base64
   blobs, e-mail addresses, IP literals and bool/number/enum values and emits
   explicit negative rules, visible in --explain and every report, so a shape
   demotion never hides a candidate silently.

Config gains name_lang, fold_names and demote_shapes (validated, merged
through extends, carried through the CLI merge). Version 2.2.0.

Tests: 335 total (127 new) covering watch polling and rotation, interactive
markup and script guarantees, rule validation and overrides, policy gates,
JUnit/annotation escaping, self-test, every tool format, folding/i18n edge
cases, demotion thresholds, dedupe/limits/stats/progress, README anchors and
the shipped CI files. README adds eight sections and a full CLI table.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…g, bundles

Ten features from the 2.3 menu, all wired into the CLI:

1.  --tui        curses reviewer: list/details/filter/mark/save, no TTY -> clear error
2.  --history    append runs to JSON (values never stored); --trend shows
                 new/known/resolved, drift and a sparkline
3.  install.sh / install.cmd / Dockerfile: POSIX, Windows and container installs
                 plus --doctor environment checks
4.  --dashboard  percentiles, bands, frequent rules, coverage gaps; --inventory
                 ranks endpoints by distinct parameter count
5.  --ledger     SQLite reviews with a who/why/when audit trail; reviewed rows
                 are hidden on later runs (never silently), query/export/import
6.  --playbook   Markdown remediation guide per fired rule; --list-playbooks
7.  --stream     bounded-memory stdin analysis with batching and --stream-json
8.  --bundle     reproducible (fixed-timestamp) zip with report/config/rules/
                 playbook/manifest; values are always scrubbed
9.  --correlate  parameter x host matrix, shared parameters, clusters, chains
10. --scrub      redact credential-shaped values (vendor prefixes, high-entropy
                 keys, sensitive names) behind a stable <redacted:sha256[:8]>

Also: --self-test grew from 10 to 16 checks covering the new modules.

Safety properties are unchanged and tested: no networking imports, passive
analysis only, values hidden by default, banner links verbatim, candidates-not-
vulnerabilities wording, standard library only.

Tests: 414 pass (337 + 77 new in tests/test_features_v23.py, one class per
feature plus CLI integration).

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…ojects

Ten additions, all passive and stdlib-only:

1. Acceptance expiry -- --ledger-expire/--ledger-stale/--ledger-refresh.
   Ledger schema v2 (owner, expires_at) migrates v1 files in place.
   Expired reviews keep hiding candidates and are surfaced for re-review.
2. Capture-to-capture diff -- --diff-capture OLD.har against -i NEW.har.
   Reports added/removed/renamed parameters, endpoints and shape changes.
   Renames require a shared name token; shape-only pairing over-matched.
3. Offline extraction -- --extract page.html,app.js reads local HTML/JS and
   pulls fetch/axios/xhr/import/attribute URLs; nothing is fetched. Origin
   inference needs a majority host, and refuses a lone CDN-looking host
   rather than misattributing somebody's bundle.
4. Value statistics -- --value-stats length, encoding depth, separator and
   entropy bands. Counts and bands only; values are never printed.
5. Rule coverage -- --rule-coverage fired vs silent rules, and inert (weight
   0, distinct from negative-weight demotions).
6. Term packs -- --init-terms/--list-terms/--terms. Literal terms only, no
   regex by design; validated versioned JSON, committable to a team repo.
7. Preset comparison -- --compare-presets, minimal/balanced/noisy over the
   same scored candidates. Re-classification only; nothing is re-scored.
8. Calibration -- --calibrate recommends --min-score from ledger decisions
   under a stated recall/false-positive rule; refuses under 8 labels.
9. Project files -- .pathscope/project.json discovered upward from the cwd,
   supplying config/policy/terms/ledger; unknown files are contained.
10. Reviewed-aware CI -- SARIF suppressions, JUnit <skipped>, and --policy
    excluding reviewed findings unless --policy-include-reviewed.

514 tests (100 new, one class per feature) and --self-test 22/22.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Ten additions, all passive and stdlib-only (no network module is imported):

1. Path families -- --cluster groups candidates by route shape
   (/api/v1/items/{id}/view). A view, never a merge: every row keeps its
   fingerprint, so a review still covers one endpoint.
2. Review queue -- --queue orders open work by score, novelty and leverage
   (how many endpoints one decision covers), with the weights printed.
3. Policy shadow mode -- --policy-shadow evaluates a proposed gate, reports
   WOULD FAIL, and never changes the exit code or filters the report.
4. Deterministic sampling -- --sample/--sample-seed/--sample-by. SHA-256
   ranked, stratified, stable under capture growth, blind to values.
5. Scope files -- --scope-file/--init-scope. Applied before analysis; a
   wildcard never crosses a dot, out_of_scope wins, and a file that declares
   no patterns is refused rather than treated as "everything".
6. API description matching -- --openapi compares findings against a local
   OpenAPI/Swagger JSON document: undocumented endpoints and undeclared
   parameters. YAML is refused with a reason instead of half-parsed.
7. Work-item export -- --export-ticket writes per-family Markdown tickets and
   an index. Values are never included, even with --show-values.
8. PR comments -- --pr-comment/--run-id. Marker line for in-place updates, a
   verdict that follows the report rather than the caller, budgeted rows.
9. Host redaction -- --redact-hosts. Keyed HMAC pseudonyms across every
   output and artefact; paths and fingerprints are deliberately untouched.
10. Shell completion -- --completion bash|zsh|fish|powershell, generated from
    the real parser so it cannot drift.

636 tests (122 new, one class per feature) and --self-test 29/29.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Ten additions, all passive and stdlib-only:

1. Waivers -- --waivers/--init-waivers/--list-waivers. Committable JSON
   exceptions that need a reason, an owner and (usually) an expiry. Expired
   waivers hide nothing; unknown keys are errors so a typo cannot create an
   immortal waiver. Waived findings are hidden, announced, and excluded from
   --policy -- that is what a waiver is for.
2. Suppression audit -- --suppression-audit. Classifies every baseline,
   waiver and ledger entry as live, dead, overbroad or expired. Read-only.
3. Rule precision -- --rule-precision. Accepted vs false-positive per rule;
   under 5 labels a rule is reported but never judged.
4. Rule impact -- --rule-impact. Points contributed, and 'deciding': findings
   that would fall below the threshold without the rule.
5. Weight simulation -- --simulate. Genuinely re-analyses under hypothetical
   weights rather than subtracting a share of a capped score. Never writes.
6. Score-change explanation -- --explain-diff. Two saved reports, tracked by
   (host, path, parameter, location); names the rule whose evidence moved.
7. --where. Hand-written tokenizer and parser; eval is never used. Errors
   carry a position. Filtering never changes the exit code: the gate still
   judges the unfiltered set, so a filter cannot create a false green.
8. Attestation -- --attest/--verify-attest. Digests over input bytes,
   effective settings and the rendered output. Explicitly unsigned.
9. Owner assignment -- --assign-owners/--assign-by/--assign-dir. Rendezvous
   hashing: deterministic, stable under team growth, one owner per stratum.
10. Ledger merge -- --ledger-merge/--merge-apply/--merge-prefer. Conflicts
    are surfaced, never silently resolved; dry run is the default; the audit
    trail records each merged row.

Also fixes the host-doubling defect (a.testhttps://a.test/view) in a shared
textutil.display_location() helper instead of a fifth local copy.

769 tests (133 new, one class per feature) and --self-test 35/35.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@mrdineshpathro
mrdineshpathro merged commit a321bff into main Nov 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant